import { request } from '@/utils/request'

// 获取录播老师列表
export const getTeacherList = (pageNum: any, pageSize: any, search?: any) =>
  request<any>(
    `/aicourse/userInfo/selectTeacherList?pageNum=${pageNum}&pageSize=${pageSize}&search=${search}`,
    'GET'
  )

// 录播列表
export const getRecordList = (
  xn: any,
  pageNum: any,
  pageSize: any,
  deptCode?: any,
  xq?: any,
  bh?: any,
  gh?: any,
  searchCourse?: any,
  open?: any,
  orderByColumn?: any,
  isAsc?: any
) => {
  // 初始化 URL，包含必填参数
  let url = `/aicourse/jskcToday/recordPage?xn=${xn}&pageNum=${pageNum}&pageSize=${pageSize}`

  // 动态添加可选参数
  if (deptCode) {
    url += `&deptCode=${deptCode}`
  }
  if (xq) {
    url += `&xq=${xq}`
  }
  if (bh) {
    url += `&bh=${bh}`
  }
  if (gh) {
    url += `&gh=${gh}`
  }
  if (searchCourse) {
    url += `&searchCourse=${searchCourse}`
  }
  if (open) {
    url += `&open=${open}`
  }
  if (orderByColumn) {
    url += `&orderByColumn=${orderByColumn}`
  }
  if (isAsc) {
    url += `&isAsc=${isAsc}`
  }

  return request<any>(url, 'GET')
}

// 录播详情目录
export const getCatalogue = (
  // classRoomNo: any,
  kch: any,
  xn: any,
  xq: any,
  bh: any,
  pageNum: any,
  pageSize: any
) =>
  request<any>(
    `/aicourse/jskcToday/list?kch=${kch}&xn=${xn}&xq=${xq}&bh=${bh}&pageNum=${pageNum}&pageSize=${pageSize}&orderByColumn=viewDate,classSeq&isAsc=descending,descending`,
    'GET'
  )

// 查询观看人数
export const getLookPeoples = (kch: any) =>
  request<any>(`/aicourse/videoWatchRecord/listWatchUser?kch=${kch}`, 'GET')

// 获取录播视频播放
export const getRecordVideoList = (
  classRoomNo: any,
  viewDate: any,
  classSeq: any,
  userName: any
) =>
  request<any>(
    `/aicourse/video/getRecordUrls?classRoomNo=${classRoomNo}&viewDate=${viewDate}&classSeq=${classSeq}&userName=${userName}`,
    'GET'
  )

// 获取内容总结弹窗
export const getContentSum = (
  viewDate: any,
  classSeq: any,
  classRoomNo: any,
  knowledgeLevel: any
) =>
  request<any>(
    `/aicourse/aiKnowledgeGraph/list?viewDate=${viewDate}&classSeq=${classSeq}&classRoomNo=${classRoomNo}&knowledgeLevel=${knowledgeLevel}`,
    'GET'
  )

// 获取学院
export const getColleges = (search?: any) => {
  let url = `/system/dept/listCollege`
  if (search) {
    url += `?&search=${search}`
  }
  return request<any>(url, 'GET')
}

// 获取当前课程评价
export const getevaluate = (xn: any, xq: any, courseNo: any) =>
  request<any>(
    `/aicourse/appraise/summary?xn=${xn}&xq=${xq}&courseNo=${courseNo}`,
    'GET'
  )

// 获取全校课程评价
export const getSchoolevaluate = (xn: any, xq: any) =>
  request<any>(`/aicourse/appraise/summary?xn=${xn}&xq=${xq}`, 'GET')

// 获取本学院课程评价
export const getCollegeevaluate = (xn: any, xq: any, courseNo: any) =>
  request<any>(
    `/aicourse/appraise/summaryCollege?xn=${xn}&xq=${xq}&courseNo=${courseNo}`,
    'GET'
  )

// 获取同课程评价
export const getCourseevaluate = (xn: any, xq: any, courseNo: any) =>
  request<any>(
    `/aicourse/appraise/summarySameOtherCourse?xn=${xn}&xq=${xq}&courseNo=${courseNo}`,
    'GET'
  )

// 录播获取课程详情
export const getRecordDetail = (kch: any) =>
  request<any>(`/aicourse/course/queryInfoByKch?kch=${kch}`, 'GET')

// 录播课程评价列表
export const getEvaluateList = (kch: any, xn: any, xq: any) =>
  request<any>(`/aicourse/courseScore/list?kch=${kch}&xn=${xn}&xq=${xq}`, 'GET')

// 录播相关课程
export const getrelatedCourses = (
  xn: any,
  xq: any,
  gh: any,
  pageNum: any,
  pageSize: any
) =>
  request<any>(
    `/aicourse/jskcToday/recordPage?xn=${xn}&xq=${xq}&gh=${gh}&pageNum=${pageNum}&pageSize=${pageSize}`,
    'GET'
  )

// 获取答题内容
export const getTopic = (classRoomNo: any, viewDate: any, classSeq: any) =>
  request<any>(
    `/aicourse/aiKnowledgePaperQuestion/questionList?classRoomNo=${classRoomNo}&viewDate=${viewDate}&classSeq=${classSeq}`,
    'GET'
  )
